[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
twRadioBox( bType, Msg, Title, NoButtons, Buttons,;
sButton, wT, wL, wB, wR, wSType, wFType,;
ExitKey, ActionKeys )
----------------------------------------------------------------------------
Display a window containing message text and an array of choices
which are presented as 'Radio Buttons' in the manner of an
ACHOICE() or MENU TO. The choice array can be displayed
horizontally or vertically. The function can be made to optionally
execute code passed as code blocks and can use a default or a user
defined exit key. The window is displayed with the shadow and
frame type of the currently active window.
Code to be executed, as defined in ActionKeys DOES NOT constitute
an EXIT key. It is expected that this option will seldom be used
with twRadioBox(), but the code size was NOT increased to provide
the option.
The choice array, Buttons[], has default values, as do the display
coordinates. If either the message or the choice array will write
outside the display window, it is truncated. The programmer must
ensure the allocated area is big enough to hold all the
information required.
twRadioBox() Configuration
Horizontal Vertical
+--------- Title --------+ +--------- Title ---------+
| | | |
| | | Message Text (.) one |
| Message Text | | |
| | | goes in ( ) two |
| goes in | | |
| | | this area (.) three |
| this area | | |
| | | ( ) four |
| | | |
| | | etc. |
| ( ) one (.) two etc. | | |
+------------------------+ +-------------------------+
The Up, Down, Right and Left cursor keys move the highlight one
choice, as in a MENU TO. The Page Up and Home keys highlight the
first choice. The Page Down and End keys highlight the last
choice. Any choice NOT associated with an ActionKey will cause an
exit.
twRadioBox() allows ONLY mutually exclusive choices. Choices are
toggled with the ENTER or SPACE key and displayed as a CHR( 7 ):
(.).
The passed array of choices is modified by adding three spaces for
'( )' to the beginning or each choice and padding them all to the
same length. After the choices are configured, the remaining area
inside the display window is available for the message display.
THE DEFAULT EXIT KEY FOR twRadioBox() is K_ESC, in keeping with
CUA/SAA standards. It may be changed or added to as with
twButtonBox()
Arguments:
bType - 'C' "V" or "v" for vertical choice display. "H" or
"h" for horizontal.
Msg - 'C' Character string to be displayed as a message.
The message is displayed in part of the window
left AFTER the choice array is processed.
In the vertical configuration, the choices appear
on the right and the message in the area of the
window remaining on the left. In the horizontal
configuration, the choices appear at the bottom
of the window and the message is displayed in the
top area.
Title - 'C' Optional title for the twRadioBox() window.
NoButtons - 'N' If using the defaults, you may pass 1, 2 or 3 to
indicate the number of buttons to display. If you
pass this parameter, it is not necessary to pass
a choices array. If you pass a choices array,
NoButtons is ignored.
Buttons - 'A' This array holds the choices to be displayed as
an array of strings. The function formats the
buttons to the length of the longest element in
this array. If Buttons is NOT passed, the
defaults are:
NoButtons = 1
Buttons := { "OK" }
NoButtons = 2
Buttons := { "Yes", "No" }
NoButtons = 3
Buttons := { "Yes", "No", "Cancel" }
sButton - 'N' The number of the default button to start with.
wT, wL - 'N' Screen coordinates for the display
wB, wR area.
wSType - 'N' TSDWIN shadow type. Defaults to the shadow type
for the currently active window.
wFType - 'N' TSDWIN frame type. Defaults to the frame type for
the currently active window.
ExitKey - 'A' The default exit key array is
{ K_ESC }
If you want to allow more, say, pass an array
like:
{ K_ESC, K_F4 }
ActionKeys - 'A' This optional parameter allows you to require
twRadioBox() to execute code WITHOUT exiting.
Each element in the array must have two elements,
the first to indicate which choice button you
wish to invoke, the second, a code block to
execute when that button is invoked.
Return:
The return value is the selected element number or zero if an
ExitKey was chosen.
Example:
The following code fragment is an excerpt from WINDEMO.PRG.
twRadioBox( "H", ; // Style
AText2, ; // Message
"This Uses twRadioBox()",, ; // Title ( Button Number)
{ "What's On", "The Radio", ; // Button
"Tonight", "Dear" }, ; // Array
3, 2, 3, 21, 76, 7, 6 ) // Start
// Coords, Shadow, Frame
See Also:
twAlertInit()
twButtonBox()
twCheckBox()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson